﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MapLib.Properties;
using MapWinGIS;

namespace MapLib
{
    public partial class ucToolStrip : UserControl
    {
        private AxMapWinGIS.AxMap axMap1;
        public ucToolStrip(AxMapWinGIS.AxMap map)
        {
            InitializeComponent();
            axMap1 = map;
        }

        private ImageList imgList = new ImageList();
        public void ToolStripSetup()
        {
            //// Create the ImageList

            imgList.ImageSize = new Size(18, 16);
            imgList.ColorDepth = ColorDepth.Depth4Bit;
            imgList.TransparentColor = Color.FromArgb(192, 192, 192);

            // adds the bitmap
            //if (File.Exists("buttons.bmp"))
            //{
            //Bitmap bmp = new Bitmap("buttons.bmp");

            imgList.Images.AddStrip(Resources.buttons);
            //}

            toolStripButtonSelectTool.Image = imgList.Images[9];
            toolStripButtonPanTool.Image = imgList.Images[18];
            toolStripButtonZoomIn.Image = imgList.Images[15];
            toolStripButtonZoomOut.Image = imgList.Images[16];
            toolStripButtonDistance.Image = imgList.Images[31];
            toolStripButtonAllLayersView.Image = imgList.Images[32];
        }

        private void toolStripButtonSelectTool_Click(object sender, EventArgs e)
        {
            axMap1.CursorMode = tkCursorMode.cmSelection;
        }

        private void toolStripButtonPanTool_Click(object sender, EventArgs e)
        {
            axMap1.CursorMode = tkCursorMode.cmPan;
        }

        private void toolStripButtonZoomIn_Click(object sender, EventArgs e)
        {
            axMap1.CursorMode = tkCursorMode.cmZoomIn;
        }

        private void toolStripButtonZoomOut_Click(object sender, EventArgs e)
        {
            axMap1.CursorMode = tkCursorMode.cmZoomOut;
        }

        private void toolStripButtonDistance_Click(object sender, EventArgs e)
        {

        }

        private void toolStripButtonAllLayersView_Click(object sender, EventArgs e)
        {
            axMap1.ZoomToMaxExtents();
        }

        private void toolStripButtonLatestGPS_Click(object sender, EventArgs e)
        {

        }

        private void ucToolStrip_Load(object sender, EventArgs e)
        {
            ToolStripSetup();
        }
    }
}
